<template lang="">
    <div class="user_container">
        <!-- 用户列表区域 -->
        <el-table :data="userList" vf border style="width: 100%" stripe>
            <!-- 渲染编号         -->
            <el-table-column type="index" label="#"></el-table-column>
            <!-- 渲染姓名 -->
            <el-table-column prop="userName" label="姓名"></el-table-column>
            <!-- 渲染性别 -->
            <el-table-column prop="sex" label="性别"></el-table-column>
            <!-- 渲染学号 -->
            <el-table-column prop="stuNumber" label="学号"></el-table-column>
            <!-- 渲染学校 -->
            <el-table-column prop="location" label="学校"></el-table-column>
            <!-- 渲染信誉积分 -->
            <el-table-column prop="" label="信誉积分"></el-table-column>
            <!-- 渲染状态 -->
            <el-table-column prop="status" label="状态"></el-table-column>
            <el-table-column prop="" label="操作" width="250">
                <!-- 封号按钮 -->
                <el-button type="warning" size="mini" @click="sealuser">封号</el-button>
                <!-- 解封按钮 -->
                <el-button type="success" size="mini">解封</el-button>
                <!-- 删除按钮 -->
                <el-button type="danger" size="mini">删除</el-button>
            </el-table-column>
        </el-table>
    </div>
</template>
<script>
export default {
    created() {
        this.getUserList()
    },
    data() {
        return {
            userList: []
        }
    },
    methods: {
        // 封号处理
        sealuser() {

        },
        // 解封处理
        relieveuser() {

        },
        // 删除处理
        deleteuser() {

        },
        // 获取用户信息
        async getUserList() {
            const { data:res } = await this.$http.get('/manager/userList')
            if (res.code !== 200) { return this.$message.error(res.message) }
            // 更换性别显示
            res.data.users.map(element => {
                element.sex === 1 ? element.sex = "男" : element.sex = "女"
                element.status === 0 ? element.status = "正常" : element.sex = "封号"
                return element
            });
            this.userList = res.data.users
            console.log(this.userList[0]);
        }
    },
}
</script>
<style lang="less" scoped>
    
</style>